<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<!-- 头部导航栏 -->
<jsp:include page="../header.jsp"></jsp:include>
<title>===标题===</title>
<script type="text/javascript">
$(document).ready(function() {
	//提交表单验证
	$("#data_form").submit(function () {
		var pass = true;
		//员工编号合法性验证
		var userNumber = $("#id_userNumber").val();
		if(userNumber && userNumber.length>20) {
			$("#im_userNumber").html("员工编号不能超过20个字符！").show();pass = false;
		}else {
			$("#im_userNumber").hide();
		}
		
		//用户名合法性验证
		var userName = $("#id_userName").val();
		if(!userName) {
			$("#im_userName").html("请输入合法的用户名信息！").show();pass = false;
		}else if(userName.length > 20){
			$("#im_userName").html("用户名不能超过20个字符！").show();pass = false;
		}else {
			$("#im_userName").hide();
		}
		
		//真实姓名合法性验证
		var realName = $("#id_realName").val();
		if(realName && realName.length>20) {
			$("#im_realName").html("真实姓名不能超过20个字符！").show();pass = false;
		}else {
			$("#im_realName").hide();
		}
		
		//出生日期合法性验证
		var birthday = $("#id_birthday").val();
		if(birthday && birthday.length>20) {
			$("#im_birthday").html("请输入合法的出生日期信息！").show();pass = false;
		}else {
			$("#im_birthday").hide();
		}
		
		//电子邮件合法性验证
		var email = $("#id_email").val();
		if(!email || email.length>20) {
			$("#im_email").html("请输入合法的电子邮件信息！").show();pass = false;
		}else {
			$("#im_email").hide();
		}
		
		//固定电话合法性验证
		var telephone = $("#id_telephone").val();
		if(telephone && telephone.length>20) {
			$("#im_telephone").html("请输入合法的固定电话信息！").show();pass = false;
		}else {
			$("#im_telephone").hide();
		}
		
		//手机号码合法性验证
		var mobile = $("#id_mobile").val();
		if(mobile && mobile.length>20) {
			$("#im_mobile").html("请输入合法的手机号码信息！").show();pass = false;
		}else {
			$("#im_mobile").hide();
		}
		
		//国家合法性验证
		var country = $("#id_country").val();
		if(country && country.length>20) {
			$("#im_country").html("请输入合法的国家信息！").show();pass = false;
		}else {
			$("#im_country").hide();
		}
		
		//家庭住址合法性验证
		var address = $("#id_address").val();
		if(address && address.length>20) {
			$("#im_address").html("请输入合法的家庭住址信息！").show();pass = false;
		}else {
			$("#im_address").hide();
		}
		
		return pass;
	});
});
</script>
</head>
<body>
	<div class="container dz-main">
		<!--标题和按钮组===begin===-->
		<div class="dz-head">
			<div class="dz-title">管理</div>
			<div class="dz-head-btns">
				<a class="btn btn-success btn-sm" href="<%=request.getContextPath()%>/user/user/index.do">返回</a>
			</div>
		</div>
		<!--标题和按钮组===end===-->
		<!--表单数据===begin===-->
		<form id="data_form" class="form-horizontal" action="<%=request.getContextPath()%>/user/user/save.do" method="post">
			<div>
				<input type="hidden" name="userId" value="${obj.userId}"/>
			</div>
			<div class="form-group">
				<label for="id_userNumber" class="col-xs-2 control-label">员工编号</label>
				<div class="col-xs-6">
					<input id="id_userNumber" type="text" class="form-control" name="userNumber" value="${obj.userNumber}"/>
				</div>
				<div id="im_userNumber" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_userName" class="col-xs-2 control-label"><span class="dz-flag">*</span>用户名</label>
				<div class="col-xs-6">
					<input id="id_userName" type="text" class="form-control" name="userName" value="${obj.userName}"/>
				</div>
				<div id="im_userName" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_realName" class="col-xs-2 control-label">真实姓名</label>
				<div class="col-xs-6">
					<input id="id_realName" type="text" class="form-control" name="realName" value="${obj.realName}"/>
				</div>
				<div id="im_realName" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_gender" class="col-xs-2 control-label">性别</label>
				<div class="col-xs-6">
					<select id="id_gender" type="text" class="form-control" name="gender">
						<option value="0">男</option>
						<option value="1">女</option>
					</select>
				</div>
				<div id="im_gender" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_birthday" class="col-xs-2 control-label">出生日期</label>
				<div class="col-xs-6">
					<input id="id_birthday" type="text" class="form-control" name="birthday" value="${obj.birthday}"/>
				</div>
				<div id="im_birthday" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_email" class="col-xs-2 control-label"><span class="dz-flag">*</span>电子邮件</label>
				<div class="col-xs-6">
					<input id="id_email" type="text" class="form-control" name="email" value="${obj.email}"/>
				</div>
				<div id="im_email" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_telephone" class="col-xs-2 control-label">固定电话</label>
				<div class="col-xs-6">
					<input id="id_telephone" type="text" class="form-control" name="telephone" value="${obj.telephone}"/>
				</div>
				<div id="im_telephone" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_mobile" class="col-xs-2 control-label">手机号码</label>
				<div class="col-xs-6">
					<input id="id_mobile" type="text" class="form-control" name="mobile" value="${obj.mobile}"/>
				</div>
				<div id="im_mobile" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_country" class="col-xs-2 control-label">国家</label>
				<div class="col-xs-6">
					<input id="id_country" type="text" class="form-control" name="country" value="${obj.country}"/>
				</div>
				<div id="im_country" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_address" class="col-xs-2 control-label">家庭住址</label>
				<div class="col-xs-6">
					<input id="id_address" type="text" class="form-control" name="address" value="${obj.address}"/>
				</div>
				<div id="im_address" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_political" class="col-xs-2 control-label">政治面貌</label>
				<div class="col-xs-6">
					<select id="id_political" type="text" class="form-control" name="political">
						<option value="0">群众</option>
						<option value="1">党员</option>
						<option value="2">团员</option>
					</select>
				</div>
				<div id="im_political" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_orgId" class="col-xs-2 control-label">所属组织</label>
				<div class="col-xs-6">
					<select id="id_orgId" type="text" class="form-control" name="orgId">
						<option value="0">未授权</option>
						<option value="1">已授权</option>
						<option value="2">禁用</option>
					</select>
				</div>
				<div id="im_orgId" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_status" class="col-xs-2 control-label">用户状态</label>
				<div class="col-xs-6">
					<select id="id_status" type="text" class="form-control" name="status">
						<option value="0">未授权</option>
						<option value="1">已授权</option>
						<option value="2">禁用</option>
					</select>
				</div>
				<div id="im_status" class="col-xs-4 dz-info"></div>
			</div>
			<div class="form-group">
				<label for="id_description" class="col-xs-2 control-label">描述信息</label>
				<div class="col-xs-6">
					<textarea id="id_description" class="form-control" name="description" rows="3">${obj.description}</textarea>
				</div>
				<div id="im_description" class="col-xs-4 dz-info"></div>
			</div>
			<div class="dz-submit-b">
				<button type="submit" class="btn btn-primary">保存</button>
			</div>
		</form>
		<!--表单数据===end===-->
	</div>
</body>
</html>